package com.ruoyi.blsj.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.blsj.mapper.BlsjBgsjzlMapper;
import com.ruoyi.blsj.domain.BlsjBgsjzl;
import com.ruoyi.blsj.service.IBlsjBgsjzlService;
import com.ruoyi.common.core.text.Convert;

/**
 * 报告事件资料Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-09
 */
@Service
public class BlsjBgsjzlServiceImpl implements IBlsjBgsjzlService 
{
    @Autowired
    private BlsjBgsjzlMapper blsjBgsjzlMapper;

    /**
     * 查询报告事件资料
     * 
     * @param id 报告事件资料主键
     * @return 报告事件资料
     */
    @Override
    public BlsjBgsjzl selectBlsjBgsjzlById(Long id)
    {
        return blsjBgsjzlMapper.selectBlsjBgsjzlById(id);
    }

    /**
     * 查询报告事件资料列表
     * 
     * @param blsjBgsjzl 报告事件资料
     * @return 报告事件资料
     */
    @Override
    public List<BlsjBgsjzl> selectBlsjBgsjzlList(BlsjBgsjzl blsjBgsjzl)
    {
        return blsjBgsjzlMapper.selectBlsjBgsjzlList(blsjBgsjzl);
    }

    /**
     * 新增报告事件资料
     * 
     * @param blsjBgsjzl 报告事件资料
     * @return 结果
     */
    @Override
    public int insertBlsjBgsjzl(BlsjBgsjzl blsjBgsjzl)
    {
        blsjBgsjzl.setCreateTime(DateUtils.getNowDate());
        return blsjBgsjzlMapper.insertBlsjBgsjzl(blsjBgsjzl);
    }

    /**
     * 修改报告事件资料
     * 
     * @param blsjBgsjzl 报告事件资料
     * @return 结果
     */
    @Override
    public int updateBlsjBgsjzl(BlsjBgsjzl blsjBgsjzl)
    {
        return blsjBgsjzlMapper.updateBlsjBgsjzl(blsjBgsjzl);
    }

    /**
     * 批量删除报告事件资料
     * 
     * @param ids 需要删除的报告事件资料主键
     * @return 结果
     */
    @Override
    public int deleteBlsjBgsjzlByIds(String ids)
    {
        return blsjBgsjzlMapper.deleteBlsjBgsjzlByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除报告事件资料信息
     * 
     * @param id 报告事件资料主键
     * @return 结果
     */
    @Override
    public int deleteBlsjBgsjzlById(Long id)
    {
        return blsjBgsjzlMapper.deleteBlsjBgsjzlById(id);
    }

	@Override
	public void updateBlsjBgsjzlByWorkId(BlsjBgsjzl blsjBgsjzl) {
		blsjBgsjzlMapper.updateBlsjBgsjzlByWorkId(blsjBgsjzl);
	}

	@Override
	public List<Map<String, Object>> selectTjlbReport(BlsjBgsjzl blsjBgsjzl) {
		if("1".equals(blsjBgsjzl.getParams().get("tjlb").toString())){
			return blsjBgsjzlMapper.selectTjlbReport1(blsjBgsjzl);
		}else if("2".equals(blsjBgsjzl.getParams().get("tjlb").toString())){
			return blsjBgsjzlMapper.selectTjlbReport2(blsjBgsjzl);
		}else if("3".equals(blsjBgsjzl.getParams().get("tjlb").toString())){
			return blsjBgsjzlMapper.selectTjlbReport3(blsjBgsjzl);
		}else if("4".equals(blsjBgsjzl.getParams().get("tjlb").toString())){
			return blsjBgsjzlMapper.selectTjlbReport4(blsjBgsjzl);
		}
		return null;
	}
}
